package com.ymttest.business.data;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

import org.apache.http.client.ClientProtocolException;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.ymt.base.YmatouBaseCall;
import com.ymt.base.YmatouEasyCall;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymttest.utils.TestDataManager;


public class Data {
	//TODO 需要创建套券 并 关联到前端活动
	public static void main(String[] args) throws ClientProtocolException, IOException  {
		//最后一步 拼接数据
		YmatouEasyCall createMemberCall = new YmatouEasyCall("http://evtbiz.iapi.ymatou.com/Data/GetPagePartDataInfo?PagePartId=40987", "GET", "PARAM");
		createMemberCall.callService();
		JsonArray ja = createMemberCall.getJsonObject().get("Data").getAsJsonObject().get("Data").getAsJsonObject().get("List").getAsJsonArray();
		ja.forEach(json->{
//			Logger.debug(json.getAsJsonObject().toString());
			String filebody = json.getAsJsonObject().get("CouponId").getAsInt()+","+json.getAsJsonObject().get("ActivityName").getAsString()+","+json.getAsJsonObject().get("Sign").getAsString();
			TestDataManager.appendFileToLine("PagePartIdInfo", filebody);
		});
	}
	
	
	
	
	
	
}
